package com.jinchengll.xigua.ui.viewmodel;

import android.util.Log;

import androidx.lifecycle.MutableLiveData;

import com.jinchengll.xigua.network.base.BaseObserver;
import com.jinchengll.xigua.util.ToastUtil;

import java.util.List;

/**
 * @author jinchengll
 * @since 2021/10/5
 */
public class HomeViewModel extends BaseViewModel {
    private final String TAG = "HomeViewModel";


    public MutableLiveData<List<String>> items = new MutableLiveData<>();


    public void getItems() {
        repository.getHomeItems(new BaseObserver<List<String>>() {
            @Override
            public void onSuccess(List<String> data) {
                items.setValue(data);
            }

            @Override
            public void onFailure(String errorMsg) {
                Log.e(TAG, errorMsg);
                ToastUtil.showShort(errorMsg);
            }
        });
    }

}
